package com.megvii.koala.data.bean;

import com.megvii.corelib.data.BaseBean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

/**
 * Created by linyue on 16/1/11.
 */
public class CreatureBean extends BaseBean implements Serializable
{
    public String avatar;// 展示头像

    public int subject_type; // 是否是VIP, 1不是，2是

    public String name;// 访客名

    public long start_time;// 开始时间

    public long end_time;// 离开时间

    public boolean visit_notify; // 是否提醒

    public int purpose;// 来访目的 0: 其他, 1: 面试, 2: 商务, 3: 亲友, 4: 快递送货

    public String remark;// 访客备注

    public String description;// 描述（欢迎语）

    public String department;// 部门

    public String phone;// 电话

    public String email;

    public String gender;

    public String title;//职位

    public String job_number;   //工号

    public String nameFirst = "";// 访客名首字

    public String pingyinName = "";// 访客拼音

    public String zimuName = "";// 访客首拼音

    public String test = "";

    public String pinyin = "";

    public String come_from;        //访客所属单位

    public List<UpPictureBean> photos = new ArrayList<UpPictureBean>();// 底库照片

    public boolean hasPhoto()
    {
        return !photos.isEmpty();
    }

    public void removePhoto(int index)
    {
        photos.remove(index);
    }

    public void updatePhoto(UpPictureBean picture, String removeId)
    {
        if (photos != null)
        {
            if (removeId != null)
            {
                Iterator<UpPictureBean> iterator = photos.iterator();
                while (iterator.hasNext())
                {
                    UpPictureBean oriPicture  = iterator.next();
                    if (oriPicture != null && oriPicture.id.equals(removeId))
                    {
                        iterator.remove();
                    }
                }
            }
            photos.add(picture);
        }
    }

    public enum CreatureType
    {
        STAFF,
        VISITOR
    }
}
